package com.whale.widget;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.whale.R;

/**
 * 查看更多的View
 * 
 * @author lzk
 * 
 */
public class SeeMoreView extends LinearLayout {
	private Context context = null;
	private View childView = null;
	private ProgressBar pb = null;

	public SeeMoreView(Context context) {
		super(context);
		this.context = context;

		this.setOrientation(LinearLayout.VERTICAL);
		this.setLayoutParams(new ListView.LayoutParams(
				ListView.LayoutParams.FILL_PARENT,
				ListView.LayoutParams.WRAP_CONTENT));

		View view = LayoutInflater.from(this.context)
				.inflate(R.layout.seemore, null);
		pb = (ProgressBar) view.findViewById(R.id.pb);
		this.addView(view);
		childView = view;
		getTextView().setText(R.string.more);
	}

	public TextView getTextView() {
		return (TextView) childView.findViewById(R.id.trendContent);
	}

	public void setProgressBarActive(boolean active) {
		if (active) {
			getTextView().setText(R.string.fetching);
			pb.setVisibility(View.VISIBLE);
		} else {
			getTextView().setText(R.string.more);
			pb.setVisibility(View.GONE);
		}
	}
}
